package com.imooc.infra.repository.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imooc.infra.repository.entity.TDataCenterStorage;
import com.imooc.infra.repository.mapper.TDataCenterStorageMapper;
import com.imooc.infra.repository.service.ITDataCenterStorageService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 18870
 * @since 2023-05-27
 */
@Service
public class TDataCenterStorageServiceImpl extends ServiceImpl<TDataCenterStorageMapper, TDataCenterStorage> implements ITDataCenterStorageService {

    @Override
    public TDataCenterStorage getByRuleId(Long ruleId) {
        LambdaQueryWrapper<TDataCenterStorage> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TDataCenterStorage::getRule, ruleId);
        wrapper.orderByDesc(TDataCenterStorage::getGmtCreate);
        return this.defaultGetOne(wrapper);
    }
}
